package boardgamer.common.client.testing;

import boardgamer.common.client.HasEventHandler;

import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;

/**
 * @author garysoed
 */
public class MockEventHandler implements HasEventHandler.EventHandler {

  public boolean isCalled = false;
  public float eventX;
  public float eventY;
  public int eventAction;

  @Override public void onEvent(float eventX, float eventY, int eventAction) {
    this.isCalled = true;
    this.eventX = eventX;
    this.eventY = eventY;
    this.eventAction = eventAction;
  }
  
  public void assertCalled(float eventX, float eventY, int eventAction) {
    assertTrue(isCalled);
    assertEquals(eventX, this.eventX);
    assertEquals(eventY, this.eventY);
    assertEquals(eventAction, this.eventAction);
  }
}
